<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Linux文件管理 | 江流</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/favicon.ico">
    <script>
	  var _hmt = _hmt || [];
	  (function() {
	    var hm = document.createElement("script");
		hm.src = "https://hm.baidu.com/hm.js?d53065bd59576478808301d9b305d57a";
	    var s = document.getElementsByTagName("script")[0]; 
	    s.parentNode.insertBefore(hm, s);
	  })();
	  </script>        
	  </script>
    <meta name="description" content="我的知识存储空间，不大不小刚刚好！">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/assets/css/0.styles.f7444686.css" as="style"><link rel="preload" href="/assets/js/app.371ed010.js" as="script"><link rel="preload" href="/assets/js/3.fe7e7b6d.js" as="script"><link rel="preload" href="/assets/js/1.adb5634c.js" as="script"><link rel="preload" href="/assets/js/73.72e019b5.js" as="script"><link rel="prefetch" href="/assets/js/10.1f1951c3.js"><link rel="prefetch" href="/assets/js/100.61abc83e.js"><link rel="prefetch" href="/assets/js/101.36b1a9cd.js"><link rel="prefetch" href="/assets/js/102.ab6aaef1.js"><link rel="prefetch" href="/assets/js/103.56b65027.js"><link rel="prefetch" href="/assets/js/104.10a9920d.js"><link rel="prefetch" href="/assets/js/105.2af1fce1.js"><link rel="prefetch" href="/assets/js/106.89d909fa.js"><link rel="prefetch" href="/assets/js/107.8a051ba9.js"><link rel="prefetch" href="/assets/js/108.8d32e2bb.js"><link rel="prefetch" href="/assets/js/109.98a9c733.js"><link rel="prefetch" href="/assets/js/11.4f1a38c2.js"><link rel="prefetch" href="/assets/js/110.cb2819bf.js"><link rel="prefetch" href="/assets/js/111.3763e438.js"><link rel="prefetch" href="/assets/js/112.437502fc.js"><link rel="prefetch" href="/assets/js/113.c84b80e9.js"><link rel="prefetch" href="/assets/js/114.e8265ab7.js"><link rel="prefetch" href="/assets/js/115.5950f39b.js"><link rel="prefetch" href="/assets/js/116.7082589d.js"><link rel="prefetch" href="/assets/js/117.9ab33002.js"><link rel="prefetch" href="/assets/js/118.b03051ef.js"><link rel="prefetch" href="/assets/js/119.31fe4216.js"><link rel="prefetch" href="/assets/js/12.397d3f87.js"><link rel="prefetch" href="/assets/js/120.4d52fd08.js"><link rel="prefetch" href="/assets/js/121.024a68dc.js"><link rel="prefetch" href="/assets/js/122.75cd9e9a.js"><link rel="prefetch" href="/assets/js/123.3060f162.js"><link rel="prefetch" href="/assets/js/124.b65e3f9b.js"><link rel="prefetch" href="/assets/js/125.87d06856.js"><link rel="prefetch" href="/assets/js/126.23d0d6ec.js"><link rel="prefetch" href="/assets/js/127.1ff7063e.js"><link rel="prefetch" href="/assets/js/128.e7a78683.js"><link rel="prefetch" href="/assets/js/129.3a378a54.js"><link rel="prefetch" href="/assets/js/13.d1346059.js"><link rel="prefetch" href="/assets/js/130.3820ccc0.js"><link rel="prefetch" href="/assets/js/14.961feb61.js"><link rel="prefetch" href="/assets/js/15.61355499.js"><link rel="prefetch" href="/assets/js/16.6759c278.js"><link rel="prefetch" href="/assets/js/17.39315298.js"><link rel="prefetch" href="/assets/js/18.9995ddc3.js"><link rel="prefetch" href="/assets/js/19.e7007f1f.js"><link rel="prefetch" href="/assets/js/20.8284a0ff.js"><link rel="prefetch" href="/assets/js/21.42efcf40.js"><link rel="prefetch" href="/assets/js/22.ce83188a.js"><link rel="prefetch" href="/assets/js/23.125b374b.js"><link rel="prefetch" href="/assets/js/24.9a24b2f6.js"><link rel="prefetch" href="/assets/js/25.61d7e926.js"><link rel="prefetch" href="/assets/js/26.4c271fce.js"><link rel="prefetch" href="/assets/js/27.08314644.js"><link rel="prefetch" href="/assets/js/28.44a30857.js"><link rel="prefetch" href="/assets/js/29.4b86327a.js"><link rel="prefetch" href="/assets/js/30.284e1438.js"><link rel="prefetch" href="/assets/js/31.c7fb218e.js"><link rel="prefetch" href="/assets/js/32.9591edea.js"><link rel="prefetch" href="/assets/js/33.52d0ee09.js"><link rel="prefetch" href="/assets/js/34.24dce9bc.js"><link rel="prefetch" href="/assets/js/35.e9e59a19.js"><link rel="prefetch" href="/assets/js/36.470d3b70.js"><link rel="prefetch" href="/assets/js/37.f43d4d57.js"><link rel="prefetch" href="/assets/js/38.bb14e7a9.js"><link rel="prefetch" href="/assets/js/39.4238fcd3.js"><link rel="prefetch" href="/assets/js/4.10111819.js"><link rel="prefetch" href="/assets/js/40.eb5830d8.js"><link rel="prefetch" href="/assets/js/41.f2de0dd7.js"><link rel="prefetch" href="/assets/js/42.ee6bc670.js"><link rel="prefetch" href="/assets/js/43.aeb80fc2.js"><link rel="prefetch" href="/assets/js/44.3dcf73d7.js"><link rel="prefetch" href="/assets/js/45.f60dd2b7.js"><link rel="prefetch" href="/assets/js/46.3ffd9a49.js"><link rel="prefetch" href="/assets/js/47.0629cfd8.js"><link rel="prefetch" href="/assets/js/48.4064d363.js"><link rel="prefetch" href="/assets/js/49.e5cd2868.js"><link rel="prefetch" href="/assets/js/5.bbaa5544.js"><link rel="prefetch" href="/assets/js/50.e1524d44.js"><link rel="prefetch" href="/assets/js/51.ef5d60b4.js"><link rel="prefetch" href="/assets/js/52.9e15bbc1.js"><link rel="prefetch" href="/assets/js/53.9e53a9b3.js"><link rel="prefetch" href="/assets/js/54.bda58726.js"><link rel="prefetch" href="/assets/js/55.cdc29215.js"><link rel="prefetch" href="/assets/js/56.3f0607d3.js"><link rel="prefetch" href="/assets/js/57.b45ba0fb.js"><link rel="prefetch" href="/assets/js/58.12450427.js"><link rel="prefetch" href="/assets/js/59.33096dcc.js"><link rel="prefetch" href="/assets/js/6.8df5fb44.js"><link rel="prefetch" href="/assets/js/60.98645e3a.js"><link rel="prefetch" href="/assets/js/61.413d9151.js"><link rel="prefetch" href="/assets/js/62.cc3b9f5a.js"><link rel="prefetch" href="/assets/js/63.05784f29.js"><link rel="prefetch" href="/assets/js/64.d6d2548e.js"><link rel="prefetch" href="/assets/js/65.dfa3ba68.js"><link rel="prefetch" href="/assets/js/66.bb4f5fde.js"><link rel="prefetch" href="/assets/js/67.2c282a4f.js"><link rel="prefetch" href="/assets/js/68.ce435a87.js"><link rel="prefetch" href="/assets/js/69.e439f6e2.js"><link rel="prefetch" href="/assets/js/7.751d2655.js"><link rel="prefetch" href="/assets/js/70.270cc6b6.js"><link rel="prefetch" href="/assets/js/71.ad1e4a0b.js"><link rel="prefetch" href="/assets/js/72.0adf2b53.js"><link rel="prefetch" href="/assets/js/74.a4eb5a17.js"><link rel="prefetch" href="/assets/js/75.6412ff6f.js"><link rel="prefetch" href="/assets/js/76.7f462fc1.js"><link rel="prefetch" href="/assets/js/77.16502231.js"><link rel="prefetch" href="/assets/js/78.3082b00c.js"><link rel="prefetch" href="/assets/js/79.4f375500.js"><link rel="prefetch" href="/assets/js/8.6c3fab20.js"><link rel="prefetch" href="/assets/js/80.0f2472d6.js"><link rel="prefetch" href="/assets/js/81.136b6c89.js"><link rel="prefetch" href="/assets/js/82.6f5b7de7.js"><link rel="prefetch" href="/assets/js/83.0eb8579b.js"><link rel="prefetch" href="/assets/js/84.b50a036d.js"><link rel="prefetch" href="/assets/js/85.e7b43c1a.js"><link rel="prefetch" href="/assets/js/86.0cbd7e7b.js"><link rel="prefetch" href="/assets/js/87.647fd8a9.js"><link rel="prefetch" href="/assets/js/88.be268039.js"><link rel="prefetch" href="/assets/js/89.2c0b397f.js"><link rel="prefetch" href="/assets/js/9.ace3bd0d.js"><link rel="prefetch" href="/assets/js/90.fb93a187.js"><link rel="prefetch" href="/assets/js/91.45160178.js"><link rel="prefetch" href="/assets/js/92.4e47d015.js"><link rel="prefetch" href="/assets/js/93.2f9bae72.js"><link rel="prefetch" href="/assets/js/94.c68d9319.js"><link rel="prefetch" href="/assets/js/95.a6932cad.js"><link rel="prefetch" href="/assets/js/96.dea31892.js"><link rel="prefetch" href="/assets/js/97.e8c73484.js"><link rel="prefetch" href="/assets/js/98.bf38dbf7.js"><link rel="prefetch" href="/assets/js/99.edd450af.js">
    <link rel="stylesheet" href="/assets/css/0.styles.f7444686.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container" data-v-6f8f7dda><div data-v-6f8f7dda><div class="password-shadow password-wrapper-out" style="display:none;" data-v-f68096de data-v-6f8f7dda data-v-6f8f7dda><h3 class="title" data-v-f68096de>江流</h3> <p class="description" data-v-f68096de>我的知识存储空间，不大不小刚刚好！</p> <label id="box" class="inputBox" data-v-f68096de><input type="password" value="" data-v-f68096de> <span data-v-f68096de>Konck! Knock!</span> <button data-v-f68096de>OK</button></label> <div class="footer" data-v-f68096de><span data-v-f68096de><i class="iconfont reco-theme" data-v-f68096de></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-f68096de>vuePress-theme-reco</a></span> <span data-v-f68096de><i class="iconfont reco-copyright" data-v-f68096de></i> <a data-v-f68096de><span data-v-f68096de>江流</span>
          
        <span data-v-f68096de>2018 - </span>
        2023
      </a></span></div></div> <div class="hide" data-v-6f8f7dda><header class="navbar" data-v-6f8f7dda><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/logo.png" alt="江流" class="logo"> <span class="site-name">江流</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/复盘/" class="nav-link"><i class="undefined"></i>
  复盘
</a></li><li class="dropdown-item"><!----> <a href="/categories/学习总结/" class="nav-link"><i class="undefined"></i>
  学习总结
</a></li><li class="dropdown-item"><!----> <a href="/categories/踩坑/" class="nav-link"><i class="undefined"></i>
  踩坑
</a></li><li class="dropdown-item"><!----> <a href="/categories/工具/" class="nav-link"><i class="undefined"></i>
  工具
</a></li><li class="dropdown-item"><!----> <a href="/categories/Linux/" class="nav-link"><i class="undefined"></i>
  Linux
</a></li><li class="dropdown-item"><!----> <a href="/categories/算法/" class="nav-link"><i class="undefined"></i>
  算法
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java基础/" class="nav-link"><i class="undefined"></i>
  Java基础
</a></li><li class="dropdown-item"><!----> <a href="/categories/高并发编程/" class="nav-link"><i class="undefined"></i>
  高并发编程
</a></li><li class="dropdown-item"><!----> <a href="/categories/数据库/" class="nav-link"><i class="undefined"></i>
  数据库
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java框架/" class="nav-link"><i class="undefined"></i>
  Java框架
</a></li><li class="dropdown-item"><!----> <a href="/categories/学习笔记/" class="nav-link"><i class="undefined"></i>
  学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/categories/框架学习/" class="nav-link"><i class="undefined"></i>
  框架学习
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java项目/" class="nav-link"><i class="undefined"></i>
  Java项目
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-note"></i>
      学习笔记
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/docs/major-notes/java/" class="nav-link"><i class="undefined"></i>
  Java笔记整理
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/juc/" class="nav-link"><i class="undefined"></i>
  JUC学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/jvm.html" class="nav-link"><i class="undefined"></i>
  JVM核心知识
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/vue.html" class="nav-link"><i class="undefined"></i>
  Vue入门笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/linux/" class="nav-link router-link-active"><i class="undefined"></i>
  Linux笔记整理
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/redis/" class="nav-link"><i class="undefined"></i>
  Redis学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/springcloud/" class="nav-link"><i class="undefined"></i>
  SpringCloud笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/spring/" class="nav-link"><i class="undefined"></i>
  Spring学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/shiro.html" class="nav-link"><i class="undefined"></i>
  Shiro学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/android-notes/" class="nav-link"><i class="undefined"></i>
  Android学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/project-notes/" class="nav-link"><i class="undefined"></i>
  项目笔记
</a></li></ul></div></div><div class="nav-item"><a href="/docs/collections/" class="nav-link"><i class="iconfont reco-collection"></i>
  收藏夹
</a></div><div class="nav-item"><a href="/docs/life-logs/" class="nav-link"><i class="iconfont reco-camera"></i>
  生活日志
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-browse"></i>
      常用网站
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="http://www.cxysite.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  程序员导航
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.nowcoder.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  牛客网
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://leetcode-cn.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  力扣
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-person"></i>
      私藏博客
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://docker.easydoc.net" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  快速入门docker
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.nowcoder.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  牛客网
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://leetcode-cn.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  力扣
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      联系方式
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-gitee"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://github.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-6f8f7dda></div> <aside class="sidebar" data-v-6f8f7dda><div class="personal-info-wrapper" data-v-cc06b9e8 data-v-6f8f7dda><img src="/avatar.png" alt="author-avatar" class="personal-img" data-v-cc06b9e8> <h3 class="name" data-v-cc06b9e8>
    江流
  </h3> <div class="num" data-v-cc06b9e8><div data-v-cc06b9e8><h3 data-v-cc06b9e8>104</h3> <h6 data-v-cc06b9e8>Articles</h6></div> <div data-v-cc06b9e8><h3 data-v-cc06b9e8>21</h3> <h6 data-v-cc06b9e8>Tags</h6></div></div> <ul class="social-links" data-v-cc06b9e8></ul> <hr data-v-cc06b9e8></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/复盘/" class="nav-link"><i class="undefined"></i>
  复盘
</a></li><li class="dropdown-item"><!----> <a href="/categories/学习总结/" class="nav-link"><i class="undefined"></i>
  学习总结
</a></li><li class="dropdown-item"><!----> <a href="/categories/踩坑/" class="nav-link"><i class="undefined"></i>
  踩坑
</a></li><li class="dropdown-item"><!----> <a href="/categories/工具/" class="nav-link"><i class="undefined"></i>
  工具
</a></li><li class="dropdown-item"><!----> <a href="/categories/Linux/" class="nav-link"><i class="undefined"></i>
  Linux
</a></li><li class="dropdown-item"><!----> <a href="/categories/算法/" class="nav-link"><i class="undefined"></i>
  算法
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java基础/" class="nav-link"><i class="undefined"></i>
  Java基础
</a></li><li class="dropdown-item"><!----> <a href="/categories/高并发编程/" class="nav-link"><i class="undefined"></i>
  高并发编程
</a></li><li class="dropdown-item"><!----> <a href="/categories/数据库/" class="nav-link"><i class="undefined"></i>
  数据库
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java框架/" class="nav-link"><i class="undefined"></i>
  Java框架
</a></li><li class="dropdown-item"><!----> <a href="/categories/学习笔记/" class="nav-link"><i class="undefined"></i>
  学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/categories/框架学习/" class="nav-link"><i class="undefined"></i>
  框架学习
</a></li><li class="dropdown-item"><!----> <a href="/categories/Java项目/" class="nav-link"><i class="undefined"></i>
  Java项目
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-note"></i>
      学习笔记
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/docs/major-notes/java/" class="nav-link"><i class="undefined"></i>
  Java笔记整理
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/juc/" class="nav-link"><i class="undefined"></i>
  JUC学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/jvm.html" class="nav-link"><i class="undefined"></i>
  JVM核心知识
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/vue.html" class="nav-link"><i class="undefined"></i>
  Vue入门笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/linux/" class="nav-link router-link-active"><i class="undefined"></i>
  Linux笔记整理
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/redis/" class="nav-link"><i class="undefined"></i>
  Redis学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/springcloud/" class="nav-link"><i class="undefined"></i>
  SpringCloud笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/major-notes/spring/" class="nav-link"><i class="undefined"></i>
  Spring学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/more-notes/shiro.html" class="nav-link"><i class="undefined"></i>
  Shiro学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/android-notes/" class="nav-link"><i class="undefined"></i>
  Android学习笔记
</a></li><li class="dropdown-item"><!----> <a href="/docs/project-notes/" class="nav-link"><i class="undefined"></i>
  项目笔记
</a></li></ul></div></div><div class="nav-item"><a href="/docs/collections/" class="nav-link"><i class="iconfont reco-collection"></i>
  收藏夹
</a></div><div class="nav-item"><a href="/docs/life-logs/" class="nav-link"><i class="iconfont reco-camera"></i>
  生活日志
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-browse"></i>
      常用网站
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="http://www.cxysite.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  程序员导航
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.nowcoder.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  牛客网
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://leetcode-cn.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  力扣
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-person"></i>
      私藏博客
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://docker.easydoc.net" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  快速入门docker
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.nowcoder.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  牛客网
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://leetcode-cn.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="undefined"></i>
  力扣
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      联系方式
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-gitee"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://github.com/" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Algorithm</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Java</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Juc</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Linux</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/docs/major-notes/linux/01-common-operates.html" class="sidebar-link">Linux基本操作</a></li><li><a href="/docs/major-notes/linux/02-file-manage.html" aria-current="page" class="active sidebar-link">Linux文件管理</a></li><li><a href="/docs/major-notes/linux/03-rpm-yum.html" class="sidebar-link">RPM管理器</a></li><li><a href="/docs/major-notes/linux/05-user-manage.html" class="sidebar-link">用户与用户组管理</a></li><li><a href="/docs/major-notes/linux/07-vim-editor.html" class="sidebar-link">Vim编辑器</a></li><li><a href="/docs/major-notes/linux/08-shell-program.html" class="sidebar-link">shell 编程</a></li><li><a href="/docs/major-notes/linux/09-process-manage.html" class="sidebar-link">Linux进程管理</a></li><li><a href="/docs/major-notes/linux/10-docker-comman.html" class="sidebar-link">Docker</a></li><li><a href="/docs/major-notes/linux/11-lnmp-env.html" class="sidebar-link">LNMP环境搭建</a></li><li><a href="/docs/major-notes/linux/12-servers-env.html" class="sidebar-link">常见Linux服务器部署</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Mysql</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Redis</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>SpringBoot</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Springcloud</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-f68096de data-v-6f8f7dda><h3 class="title" data-v-f68096de>Linux文件管理</h3> <!----> <label id="box" class="inputBox" data-v-f68096de><input type="password" value="" data-v-f68096de> <span data-v-f68096de>Konck! Knock!</span> <button data-v-f68096de>OK</button></label> <div class="footer" data-v-f68096de><span data-v-f68096de><i class="iconfont reco-theme" data-v-f68096de></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-f68096de>vuePress-theme-reco</a></span> <span data-v-f68096de><i class="iconfont reco-copyright" data-v-f68096de></i> <a data-v-f68096de><span data-v-f68096de>江流</span>
          
        <span data-v-f68096de>2018 - </span>
        2023
      </a></span></div></div> <div data-v-6f8f7dda><div data-v-6f8f7dda><main class="page"><section style="display:;"><div class="page-title"><h1 class="title">Linux文件管理</h1> <div data-v-1e62957f><i class="iconfont reco-account" data-v-1e62957f><span data-v-1e62957f>江流</span></i> <i class="iconfont reco-date" data-v-1e62957f><span data-v-1e62957f>11/22/2021</span></i> <!----> <i class="tags iconfont reco-tag" data-v-1e62957f><span class="tag-item" data-v-1e62957f>Linux</span></i></div></div> <div class="theme-reco-content content__default"><h2 id="linux-文件基础知识"><a href="#linux-文件基础知识" class="header-anchor">#</a> Linux 文件基础知识</h2> <h3 id="linux-常用文件类别"><a href="#linux-常用文件类别" class="header-anchor">#</a> Linux 常用文件类别</h3> <ol><li><p><strong>普通文件：</strong> 不包含有文件系统的结构信息，如图形文件，数据文件，文档文件，声音文件，文件标识为 <strong>符号横线</strong></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看 /etc 目录下的文件</span>
<span class="token function">ls</span> <span class="token parameter variable">-l</span> /etc
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122085930.png" alt="image-20211122085923575"></p> <blockquote><p><strong>分类：</strong></p> <ul><li><p><strong>文本文件：</strong> 包含用户可读信息的文件，以ASCII码方式存储，可显示和打印。</p></li> <li><p><strong>二进制文件：</strong> 包含计算机可读信息的文件，可以是可执行的文件，使系统根据其中的指令完成某项工作。</p></li></ul></blockquote></li> <li><p><strong>目录文件：</strong> 存放文件名及其相关信息文件，文件标识为 <strong>d</strong></p></li></ol> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看 /usr 目录下的文件</span>
<span class="token function">ls</span> <span class="token parameter variable">-l</span> /usr
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122092715.png" alt="image-20211122092715635"></p> <ol start="3"><li><p><strong>链接文件：</strong> 类似于 windows 下的快捷方式，文件标识为 <strong>i</strong></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看 /dev/initctl 目录下的链接文件</span>
<span class="token function">ls</span> <span class="token parameter variable">-l</span> /dev/initctl
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122093345.png" alt="image-20211122093345495"></p> <blockquote><p><strong>分类：</strong></p> <ul><li>硬链接</li> <li>符号链接</li></ul></blockquote></li> <li><p><strong>设备文件：</strong> 将外部设备视为一种特殊文件，存在 /dev 目录下，文件标识为 <strong>c</strong></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看设备文件信息</span>
<span class="token function">ls</span> <span class="token parameter variable">-l</span> /dev
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122094132.png" alt="image-20211122094131977"></p></li> <li><p><strong>管道文件：</strong> 一种特殊文件，用于不同进程间的信息传递</p></li></ol> <h3 id="linux-系统目录结构"><a href="#linux-系统目录结构" class="header-anchor">#</a> Linux 系统目录结构</h3> <p><strong>基本概念</strong></p> <ul><li><p>路径：一个路径可以唯一表示一个目录或者文件，多级路径直接可以使用 / 进行分割</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 使用绝对路径切换目录bin</span>
<span class="token builtin class-name">cd</span> /bin
<span class="token comment"># 使用相对路径切换目录bin</span>
<span class="token builtin class-name">cd</span> <span class="token punctuation">..</span>/bin
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122094829.png" alt="image-20211122094829582"></p></li> <li><p>根目录：/ ，是所有目录的起点</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 进入到根目录中</span>
<span class="token builtin class-name">cd</span> /
<span class="token comment"># 查看根目录中的内容</span>
<span class="token function">ls</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122095231.png" alt="image-20211122095231703"></p></li> <li><p>用户主目录： 每个用户都有自己的主目录，root用户的主目录是/root，其他用户主目录与用户名相同，在/home目录下
<strong>~</strong> 符号表示自己的主目录</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 使用 ~ 回到自己的主目录中</span>
<span class="token builtin class-name">cd</span> ~
<span class="token comment"># 查看自己主目录的位置</span>
<span class="token builtin class-name">pwd</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122095714.png" alt="image-20211122095713962"></p></li> <li><p>工作目录：用户登录后所处的目录就是工作目录，<strong>.</strong> 表示当前目录，<strong>..</strong> 表示上级目录</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看自己的当前所在的工作目录</span>
<span class="token builtin class-name">pwd</span>
<span class="token comment"># 查看 符号 . 和 ..</span>
<span class="token function">ls</span> <span class="token parameter variable">-a</span> /
<span class="token comment"># 使用 .. 返回到上级目录</span>
<span class="token builtin class-name">cd</span> <span class="token punctuation">..</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122100123.png" alt="image-20211122100123292"></p></li></ul> <p><strong>linux系统目录及说明</strong></p> <p>Linux 以文件目录的方式组织和管理系统中所有的文件，采用树形节后组织</p> <p><img src="http://images.xbnote.top/images/20211122110425.png" alt=""></p> <ul><li><strong>/：</strong> 根目录</li> <li><strong>/bin：</strong> binaries (二进制文件) 的缩写, 存放着最经常使用的命令。</li> <li><strong>/boot：</strong> 存放启动 Linux 时使用的一些核心文件，包括一些连接文件以及镜像文件。</li> <li><strong>/dev：</strong> device (设备) 的缩写，存放的是 Linux 的外部设备文件，和访问文件的方式是相同的。</li> <li><strong>/etc：</strong> etcetera (等等) 的缩写，存放所有的系统管理所需要的配置文件和子目录。</li> <li><strong>/home：</strong> 普通用户的主目录，以用户的账号命名。</li> <li><strong>/lib：</strong> library (库) 的缩写，存放着系统最基本的动态连接共享库，其作用类似于 Windows 里的 DLL 文件。</li> <li><strong>/media：</strong> linux 系统会自动识别一些设备，例如U盘、光驱等等，当识别后，Linux 会把识别的设备挂载到这个目录下。</li> <li><strong>/mnt：</strong> 是为了让用户临时挂载别的文件系统的，我们可以将光驱挂载在 /mnt/ 上，然后进入该目录就可以查看光驱里的内容了。</li> <li><strong>/opt</strong>： optional (可选) 的缩写，这是给主机额外安装软件所摆放的目录。</li> <li><strong>/proc</strong>： processes (进程) 的缩写，存储的是当前内核运行状态的一系列特殊文件，这个目录是一个虚拟的目录，它是系统内存的映射，我们可以通过直接访问这个目录来获取系统信息。</li> <li><strong>/root：</strong> root用户的主目录</li> <li><strong>run</strong>：是一个临时文件系统，存储系统启动以来的信息。当系统重启时，这个目录下的文件应该被删掉或清除。</li> <li><strong>/sbin</strong>：是 superuser binaries (超级用户的二进制文件) 的缩写，这里存放的是系统管理员使用的系统管理程序。</li> <li><strong>/srv</strong>：该目录存放一些服务启动之后需要提取的数据。</li> <li><strong>/sys：</strong> 集成针对进程信息的 proc 文件系统、针对设备的 devfs 文件系统以及针对伪终端的 devpts 文件系统 3 种系统文件信息。</li> <li><strong>/tmp：</strong> temporary(临时) 的缩写，用来存放一些临时文件。</li> <li><strong>/usr：</strong> unix shared resources(共享资源) 的缩写，这是一个非常重要的目录，用户的很多应用程序和文件都放在这个目录下，类似于 windows 下的 program files 目录。</li> <li><strong>/usr/bin：</strong> 系统用户使用的应用程序。</li> <li><strong>/usr/src：</strong> 内核源代码默认的放置目录。</li> <li><strong>/var：</strong> variable(变量) 的缩写，这个目录中存放着在不断扩充着的东西，我们习惯将那些经常被修改的目录放在这个目录下。包括各种日志文件</li></ul> <h2 id="文件与目录的基本操作"><a href="#文件与目录的基本操作" class="header-anchor">#</a> 文件与目录的基本操作</h2> <h3 id="路径跳转、显示目录内容命令"><a href="#路径跳转、显示目录内容命令" class="header-anchor">#</a> 路径跳转、显示目录内容命令</h3> <p><strong>cd：</strong> 更改工作目录	<strong>pwd：</strong> 显示路径	<strong>ls：</strong> 列出目录的内容</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 将工作目录切换到/root目录</span>
<span class="token builtin class-name">cd</span> ~

<span class="token comment"># 显示当前路径</span>
<span class="token builtin class-name">pwd</span>

<span class="token comment"># 列出目录内容</span>
<span class="token function">ls</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122161552.png" alt="image-20211122161552013"></p> <h3 id="显示文件内容命令"><a href="#显示文件内容命令" class="header-anchor">#</a> 显示文件内容命令</h3> <p><strong>cat：</strong> 将文件内容全部输出到标准设备上	<strong>-n</strong> 显示行号</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看 /etc/profile 文件并显示行号</span>
<span class="token function">cat</span> <span class="token parameter variable">-n</span> /etc/profile
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122112956.png" alt="image-20211122112955994"></p> <p><strong>more：</strong> 一次显示一屏内容	当文件内容过大时使用该命令	只能向后查看	Q按键退出查看</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看 /etc/profile 文件的所有内容</span>
<span class="token function">more</span> /etc/profile
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122113951.png" alt="image-20211122113951270"></p> <p><strong>less：</strong>  一次显示一屏内容，类似于more	可以向前或向后查看	Q按键退出查看	上下键进行查看</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看 /etc/profile 文件的所有内容</span>
<span class="token function">less</span> /etc/profile
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122114833.png" alt="image-20211122114833183"></p> <p><strong>head：</strong> 只显示文件头几行命令	可以指定显示行数</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看文件前5行内容</span>
<span class="token function">head</span> <span class="token parameter variable">-5</span> /etc/profile
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122114429.png" alt="image-20211122114429563"></p> <p><strong>tail：</strong> 只显文件示尾几行命令	可以指定显示行数</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看文件最后5行内容</span>
<span class="token function">tail</span> <span class="token parameter variable">-5</span> /etc/profile
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122114516.png" alt="image-20211122114516524"></p> <h3 id="文件内容查询命令"><a href="#文件内容查询命令" class="header-anchor">#</a> 文件内容查询命令</h3> <p><strong>grep：</strong> 查找文件内容	 <strong>-n</strong> 显示行数	<strong>-v</strong> 反向查找</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#查看文件中包含root字符串的行</span>
<span class="token function">grep</span> root /etc/passwd
<span class="token comment">#查看进行中是否存在ssh的进程</span>
<span class="token function">ps</span> <span class="token parameter variable">-ef</span> <span class="token operator">|</span> <span class="token function">grep</span> sshd
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122115756.png" alt="image-20211122115756609"></p> <h3 id="文件查找命令"><a href="#文件查找命令" class="header-anchor">#</a> 文件查找命令</h3> <p><strong>find：</strong> 在指定目录下查找文件	<strong>-name</strong> 指定查找文件的名称</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 在/目录下查找passwd文件</span>
<span class="token function">find</span> / <span class="token parameter variable">-name</span> <span class="token string">&quot;passwd&quot;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122121915.png" alt="image-20211122121915351"></p> <h3 id="文本处理命令"><a href="#文本处理命令" class="header-anchor">#</a> 文本处理命令</h3> <p><strong>sort：</strong>  对文件内容中各行进行排序</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 对/etc/passwd文件内容进行排序显示</span>
<span class="token function">sort</span> /etc/passwd
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122122105.png" alt="image-20211122122104952"></p> <p><strong>uniq：</strong>  输出文件中的相邻的重复行	<strong>-d</strong> 显示重复行	<strong>-u</strong> 显示不重复行	<strong>-c</strong> 显示重复行数</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 显示 /root/helloworld.sh 文件内容</span>
<span class="token function">more</span> helloworld.sh

<span class="token comment"># 输出 /root/helloworld.sh 文件中相邻的重复行</span>
<span class="token function">uniq</span> <span class="token parameter variable">-d</span> helloworld.sh

<span class="token comment"># 输出 /root/helloworld.sh 文件中相邻的不重复行</span>
<span class="token function">uniq</span> <span class="token parameter variable">-u</span> helloworld.sh

<span class="token comment"># 输出 /root/helloworld.sh 文件中相邻的重复行数</span>
<span class="token function">uniq</span> <span class="token parameter variable">-c</span> helloworld.sh
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122123349.png" alt="image-20211122123349518"></p> <h3 id="文本内容统计命令"><a href="#文本内容统计命令" class="header-anchor">#</a> 文本内容统计命令</h3> <p><strong>wc：</strong> 统计文本内容	<strong>-l</strong>  统计行数	<strong>-w</strong> 统计字数</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看/etc/hosts文件的行数和字符数</span>
<span class="token function">wc</span> <span class="token parameter variable">-l</span> /etc/hosts
<span class="token function">wc</span> <span class="token parameter variable">-n</span> /etc/hosts
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122124104.png" alt="image-20211122124104645"></p> <h3 id="文本比较命令"><a href="#文本比较命令" class="header-anchor">#</a> 文本比较命令</h3> <p><strong>comm：</strong> 比较文件相同和不同的内容	<strong>-12</strong>  显示文件 A 与文件 B 都存在的行	<strong>-23</strong>  只显示文件 A 与文件 B 的不同内容</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 创建a文件，a.txt文件内容：a b c</span>
<span class="token builtin class-name">echo</span> a <span class="token operator">&gt;&gt;</span> a.txt
<span class="token builtin class-name">echo</span> b <span class="token operator">&gt;&gt;</span> a.txt
<span class="token builtin class-name">echo</span> c <span class="token operator">&gt;&gt;</span> a.txt

<span class="token comment"># 创建b文件，b文件内容: a b d</span>
<span class="token builtin class-name">echo</span> a <span class="token operator">&gt;&gt;</span> b.txt
<span class="token builtin class-name">echo</span> b <span class="token operator">&gt;&gt;</span> b.txt
<span class="token builtin class-name">echo</span> d <span class="token operator">&gt;&gt;</span> b.txt

<span class="token comment">#比较a.txt和b.txt文件相同内容</span>
<span class="token function">comm</span> <span class="token parameter variable">-12</span> a.txt b.txt
<span class="token comment">#比较a.txt和b.txt文件不同内容</span>
<span class="token function">comm</span> <span class="token parameter variable">-23</span> a.txt b.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122125133.png" alt="image-20211122125133379"></p> <p><strong>diff：</strong> 逐行比较两个文本文件，列出不同的内容	不需要对文件进行排序</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#比较2个文件不同的内容</span>
<span class="token function">diff</span> a.txt b.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122125345.png" alt="image-20211122125345454"></p> <h3 id="文件的创建、复制、移动和删除命令"><a href="#文件的创建、复制、移动和删除命令" class="header-anchor">#</a> 文件的创建、复制、移动和删除命令</h3> <p><strong>touch：</strong> 创建空白文件</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#创建空白文件a.txt</span>
<span class="token function">touch</span> a.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><strong>cp：</strong>  复制文件和目录	<strong>-r</strong>  递归复制</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 复制文件：将/root/a.txt文件复制到/root/dir1目录下，并将文件命名为aa.txt</span>
<span class="token function">cp</span> a.txt dir1/aa.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20220215094722.png" alt="image-20220215094714942"></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 复制目录：将/root/dir1目录复制到/root/dir2目录下</span>
<span class="token function">cp</span> <span class="token parameter variable">-r</span> /etc /home
<span class="token function">ls</span> /home
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122153425.png" alt="image-20211122153425192"></p> <p><strong>mv：</strong> 移动文件和目录 + 重命名</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 将/root/dir2目录移动到/root/dir1下面</span>
<span class="token function">mv</span> dir2 dir1
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122153747.png" alt="image-20211122153747277"></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 将dir1目录重命名为dir11</span>
<span class="token function">mv</span> dir1 dir11
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122154430.png" alt="image-20211122154430403"></p> <p><strong>rm：</strong> 删除文件与目录	<strong>-r</strong>  递归删除	 <strong>-f</strong>  强制删除</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 删除文件</span>
<span class="token function">rm</span> a.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122155001.png" alt="image-20211122155001892"></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 删除目录</span>
<span class="token function">rm</span> <span class="token parameter variable">-rf</span> /home/dir3
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122155524.png" alt="image-20211122155524454"></p> <h3 id="文件链接命令"><a href="#文件链接命令" class="header-anchor">#</a> 文件链接命令</h3> <p><strong>ln：</strong> 创建连接</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 创建bak/index.html文件的软链接： index</span>
<span class="token function">ln</span> bak/index.html index
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122160936.png" alt="image-20211122160936259"></p> <h3 id="目录的创建和删除命令"><a href="#目录的创建和删除命令" class="header-anchor">#</a> 目录的创建和删除命令</h3> <p><strong>mkdir：</strong> 创建目录	<strong>-p</strong>  如果目录存在就创建</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#创建dirmk目录</span>
<span class="token function">mkdir</span> dirmk
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><strong>rmdir：</strong>  删除目录	<strong>-p</strong>  递归删除目录</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#删除dirmk目录</span>
<span class="token function">rmdir</span> dirmk
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122161156.png" alt="image-20211122161156801"></p> <h2 id="文件与目录权限管理"><a href="#文件与目录权限管理" class="header-anchor">#</a> 文件与目录权限管理</h2> <h3 id="文件-目录访问权限"><a href="#文件-目录访问权限" class="header-anchor">#</a> 文件/目录访问权限</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#使用ls -l 命令，查看文件或目录的相关权限</span>
<span class="token function">ls</span> <span class="token parameter variable">-l</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122181416.png" alt="image-20211122181416233"></p> <blockquote><p><strong>r</strong>   读权限</p> <p><strong>w</strong> 写权限，对目录来说,可生成文件与子目录或删除文件与子目录</p> <p><strong>x</strong>  执行权限，对目录来说,可查找该目录下内容</p> <p><strong>-</strong>  表示没有任何权限</p> <p>例：rw- r-- ---
<strong>rw-</strong> 表示当前文件对拥有者的权限</p> <p><strong>r--</strong> 表示当前文件对同组人的权限</p> <p><strong>---</strong> 表示当前文件对其他人的权限</p> <p>在添加或者删除某个权限的时候：
<strong>u</strong> 表示拥有者</p> <p><strong>g</strong> 表示同组人</p> <p><strong>o</strong> 表示其他人</p> <p><strong>a</strong> 表示所有人</p></blockquote> <h3 id="改变文件-目录的访问权限"><a href="#改变文件-目录的访问权限" class="header-anchor">#</a> 改变文件/目录的访问权限</h3> <p><strong>chmod</strong></p> <ul><li><p>使用字母修改访问权限</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token function">chmod</span> u+x b.txt
<span class="token function">chmod</span> g-r b.txt
<span class="token function">chmod</span> u+r,g-2 b.txt
<span class="token function">chmod</span> <span class="token assign-left variable">a</span><span class="token operator">=</span>rw b.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div></li> <li><p>使用数字修改访问权限</p> <ul><li><strong>x</strong> 执行权限表示十进制数字 1</li> <li>w 写权限表示十进制数字 2</li> <li><strong>r</strong> 读权限 十进制数字 4</li></ul> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code>//7一定是1+2+4所得，表示拥有者、同组人、其他人都是可读可写可执行
<span class="token function">chmod</span> <span class="token number">777</span> b.txt
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div></li></ul> <p><img src="http://images.xbnote.top/images/20211122182551.png" alt="image-20211122182551883"></p> <h3 id="更改文件-目录的所有权"><a href="#更改文件-目录的所有权" class="header-anchor">#</a> 更改文件/目录的所有权</h3> <p><strong>chown：</strong> 详见<a href="">Linux用户管理</a></p> <h2 id="文件与目录的打包与压缩"><a href="#文件与目录的打包与压缩" class="header-anchor">#</a> 文件与目录的打包与压缩</h2> <h3 id="文档压缩"><a href="#文档压缩" class="header-anchor">#</a> 文档压缩</h3> <p><strong>gzip：</strong> 对文件进行压缩和解压缩，其扩展名为 .gz，只能对文件操作，压缩后会默认删除原文件</p> <p><strong>-c</strong> 把压缩后的文件输出到标准输出中	<strong>-d</strong> 对压缩文件进行解压缩	<strong>-r</strong> 递归压缩指定目录下及子目录下的所有文件	<strong>-l</strong> 列出压缩文件信息</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#压缩当前目录下所有的文件</span>
<span class="token function">gzip</span> *
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122162841.png" alt="image-20211122162841451"></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 压缩指定的文件b.txt。压缩后保留原文件</span>
<span class="token function">gzip</span> <span class="token parameter variable">-c</span> b.txt <span class="token operator">&gt;</span> b.txt.gz
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122163329.png" alt="image-20211122163329899"></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#将b.txt.gz文件解压到当前目录下</span>
<span class="token function">gzip</span> <span class="token parameter variable">-d</span> b.txt.gz
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122163753.png" alt="image-20211122163753784"></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#压缩dir1目录下的所有文件</span>
<span class="token function">gzip</span> <span class="token parameter variable">-r</span> dir1/
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122164100.png" alt="image-20211122164100726"></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#列出压缩文件信息</span>
<span class="token function">gzip</span> <span class="token parameter variable">-l</span> b.txt.gz
<span class="token comment"># 列表含义</span>
压缩文件的大小 未压缩文件的大小 压缩比 未压缩文件的名称
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122164355.png" alt="image-20211122164355089"></p> <h3 id="文件归档"><a href="#文件归档" class="header-anchor">#</a> 文件归档</h3> <p><strong>tar：</strong> 将多个文件一起保存到一个单独的磁带或磁盘中进行归档，使用 tar 命令归档的包通常称为 tar 包，其文件都是以 .tar 结尾
<strong>-c</strong>  将多个文件或目录进行打包	<strong>-f</strong>  指定包的文件名	<strong>-v</strong> 显示打包文件过程</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#将dir1、dir2打包到dir.tar包中</span>
<span class="token function">tar</span> <span class="token parameter variable">-cf</span> dir.tar dir1 dir2
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122170405.png" alt="image-20211122170405368"></p> <p><strong>-x</strong>   对 tar 包做解压操作	<strong>-C</strong>  解压到指定目录下</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#将dir.tar包解压至dir目录下</span>
<span class="token function">tar</span> <span class="token parameter variable">-xf</span> dir.tar <span class="token parameter variable">-C</span> <span class="token function">dir</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122170807.png" alt="image-20211122170807835"></p> <p><strong>-t</strong>  查看压缩包文件</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#查看压缩包内容</span>
<span class="token function">tar</span> <span class="token parameter variable">-tvf</span> dir.tar
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122172040.png" alt="image-20211122172040447"></p> <p><strong>-z</strong>  支持gzip解压文件</p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment">#压缩打包dir目录为tar.gz压缩文件</span>
<span class="token function">tar</span> <span class="token parameter variable">-zcvf</span> dir.tar.gz <span class="token function">dir</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122173103.png" alt="image-20211122173103569"></p> <h3 id="zip压缩"><a href="#zip压缩" class="header-anchor">#</a> zip压缩</h3> <p><strong>zip：</strong> 压缩文件或目录，压缩文件为 .zip 格式文件是 Windows 和 Linux 系统都通用的压缩文件类型，需要指定压缩之后的压缩包名。</p> <blockquote><p>centos系统默认没有提供zip和unzip命令。我们可以使用 yum 执行安装zip命令
yum install unzip zip</p></blockquote> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 使用yum安装zip</span>
yum <span class="token function">install</span> <span class="token function">unzip</span> <span class="token function">zip</span>

<span class="token comment"># 压缩a.txt文件，文件名为a.zip</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><img src="http://images.xbnote.top/images/20211122175917.png" alt="image-20211122175917359"></p></div></section> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">最近更新时间: </span> <span class="time">5/6/2023, 6:41:13 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev"><a href="/docs/major-notes/linux/01-common-operates.html" class="prev">
          Linux基本操作
        </a></span> <span class="next"><a href="/docs/major-notes/linux/03-rpm-yum.html">
          RPM管理器
        </a></span></p></div> <div class="comments-wrapper"><!----></div></main></div> <!----></div> <ul class="sub-sidebar sub-sidebar-wrapper" style="width:12rem;" data-v-6986a797 data-v-6f8f7dda><li class="level-2" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#linux-文件基础知识" class="sidebar-link reco-side-linux-文件基础知识" data-v-6986a797>Linux 文件基础知识</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#linux-常用文件类别" class="sidebar-link reco-side-linux-常用文件类别" data-v-6986a797>Linux 常用文件类别</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#linux-系统目录结构" class="sidebar-link reco-side-linux-系统目录结构" data-v-6986a797>Linux 系统目录结构</a></li><li class="level-2" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件与目录的基本操作" class="sidebar-link reco-side-文件与目录的基本操作" data-v-6986a797>文件与目录的基本操作</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#路径跳转、显示目录内容命令" class="sidebar-link reco-side-路径跳转、显示目录内容命令" data-v-6986a797>路径跳转、显示目录内容命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#显示文件内容命令" class="sidebar-link reco-side-显示文件内容命令" data-v-6986a797>显示文件内容命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件内容查询命令" class="sidebar-link reco-side-文件内容查询命令" data-v-6986a797>文件内容查询命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件查找命令" class="sidebar-link reco-side-文件查找命令" data-v-6986a797>文件查找命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文本处理命令" class="sidebar-link reco-side-文本处理命令" data-v-6986a797>文本处理命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文本内容统计命令" class="sidebar-link reco-side-文本内容统计命令" data-v-6986a797>文本内容统计命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文本比较命令" class="sidebar-link reco-side-文本比较命令" data-v-6986a797>文本比较命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件的创建、复制、移动和删除命令" class="sidebar-link reco-side-文件的创建、复制、移动和删除命令" data-v-6986a797>文件的创建、复制、移动和删除命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件链接命令" class="sidebar-link reco-side-文件链接命令" data-v-6986a797>文件链接命令</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#目录的创建和删除命令" class="sidebar-link reco-side-目录的创建和删除命令" data-v-6986a797>目录的创建和删除命令</a></li><li class="level-2" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件与目录权限管理" class="sidebar-link reco-side-文件与目录权限管理" data-v-6986a797>文件与目录权限管理</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件-目录访问权限" class="sidebar-link reco-side-文件-目录访问权限" data-v-6986a797>文件/目录访问权限</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#改变文件-目录的访问权限" class="sidebar-link reco-side-改变文件-目录的访问权限" data-v-6986a797>改变文件/目录的访问权限</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#更改文件-目录的所有权" class="sidebar-link reco-side-更改文件-目录的所有权" data-v-6986a797>更改文件/目录的所有权</a></li><li class="level-2" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件与目录的打包与压缩" class="sidebar-link reco-side-文件与目录的打包与压缩" data-v-6986a797>文件与目录的打包与压缩</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文档压缩" class="sidebar-link reco-side-文档压缩" data-v-6986a797>文档压缩</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#文件归档" class="sidebar-link reco-side-文件归档" data-v-6986a797>文件归档</a></li><li class="level-3" data-v-6986a797><a href="/docs/major-notes/linux/02-file-manage.html#zip压缩" class="sidebar-link reco-side-zip压缩" data-v-6986a797>zip压缩</a></li></ul></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div></div></div>
    <script src="/assets/js/app.371ed010.js" defer></script><script src="/assets/js/3.fe7e7b6d.js" defer></script><script src="/assets/js/1.adb5634c.js" defer></script><script src="/assets/js/73.72e019b5.js" defer></script>
  </body>
</html>
